/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;



import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Set;
import javax.persistence.*;

/**
 *
 * @author 7
 */
@Entity
@Table(name = "THEMES")
@SequenceGenerator(name="seq", sequenceName="p1_seq")
public class JPATheme implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="seq")
    @Column(name = "THEME_ID")
    private BigInteger themeId;
    @Column(name = "THEME_NAME")
    private String themeName;
    
    @ManyToMany(targetEntity=JPATestCase.class)
    @JoinTable(name = "THEMES_CASES", joinColumns = {
        @JoinColumn(name = "THEME_ID", referencedColumnName="THEME_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "TC_ID", referencedColumnName="TC_ID")})
   private Set<JPATestCase> testcase;

    public JPATheme() {
    }

    public JPATheme(BigInteger themeId) {
        this.themeId = themeId;
    }

    public BigInteger getThemeId() {
        return themeId;
    }

    public void setThemeId(BigInteger themeId) {
        this.themeId = themeId;
    }

    public String getThemeName() {
        return themeName;
    }

    public void setThemeName(String themeName) {
        this.themeName = themeName;
    }

    
    public Set<JPATestCase> getTestcase() {
        return testcase;
    }

    public void setTestcase(Set<JPATestCase> testcase) {
        this.testcase = testcase;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (themeId != null ? themeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPATheme)) {
            return false;
        }
        JPATheme other = (JPATheme) object;
        if ((this.themeId == null && other.themeId != null) || (this.themeId != null && !this.themeId.equals(other.themeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "toProj.Themes[ themeId=" + themeId + " ]";
    }
    
}
